package com.bosicen.crm.tools;

import java.util.List;

import com.google.common.collect.Lists;

public class Page implements java.io.Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/** imply if the page has previous page */  
	public boolean hasPrePage;   
       
    /** imply if the page has next page */  
    public boolean hasNextPage;   
           
    /** the number of every page */  
    public int everyPage ;   
       
    /** the total page number */  
    public int totalPage;   
          
    /** the number of current page */  
    public int currentPage;   
       
    /** the begin index of the records by the current query */  
    public int beginIndex;   
    
    public int totalRecords;
    
    public int nextpage;
    public int prepage;
       
       
    public int getTotalRecords() {
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}

	/** The default constructor */  
    public Page(){   
           
    }   
    protected List result = Lists.newArrayList();
       
    /** construct the page by everyPage   
     * @param everyPage  
     * */  
    public Page(int everyPage){   
        this.everyPage = everyPage;   
    }   
       
    /** The whole constructor */  
    public Page(boolean hasPrePage, boolean hasNextPage,     
                 int everyPage, int totalPage,    
                 int currentPage, int beginIndex,int totalRecords) {   
        this.hasPrePage = hasPrePage;   
        this.hasNextPage = hasNextPage;   
        this.everyPage = everyPage;   
        this.totalPage = totalPage;   
        this.currentPage = currentPage;   
        this.beginIndex = beginIndex;   
        this.totalRecords=totalRecords;
        this.nextpage=currentPage+1;
        this.prepage=currentPage-1;
    }   
  
    public Page(int currentPage,int everyPage) {   
		   this.everyPage = everyPage;   
		   this.currentPage = currentPage;   

    }  
    /**  
     * @return   
     * Returns the beginIndex.  
     */  
    public int getBeginIndex() {   
        return beginIndex;   
    }   
       
    /**  
     * @param beginIndex   
     * The beginIndex to set.  
     */  
    public void setBeginIndex(int beginIndex) {   
        this.beginIndex = beginIndex;   
    }   
       
    /**  
     * @return   
     * Returns the currentPage.  
     */  
    public int getCurrentPage() {   
        return currentPage;   
    }   
       
    /**  
     * @param currentPage   
     * The currentPage to set.  
     */  
    public void setCurrentPage(int currentPage) {   
        this.currentPage = currentPage;   
    }   
       
    /**  
     * @return   
     * Returns the everyPage.  
     */  
    public int getEveryPage() {   
        return everyPage;   
    }   
       
    /**  
     * @param everyPage   
     * The everyPage to set.  
     */  
    public void setEveryPage(int everyPage) {   
        this.everyPage = everyPage;   
    }   
       
    /**  
     * @return   
     * Returns the hasNextPage.  
     */  
    public boolean getHasNextPage() {   
        return hasNextPage;   
    }   
       
    /**  
     * @param hasNextPage   
     * The hasNextPage to set.  
     */  
    public void setHasNextPage(boolean hasNextPage) {   
        this.hasNextPage = hasNextPage;   
    }   
       
    /**  
     * @return   
     * Returns the hasPrePage.  
     */  
    public boolean getHasPrePage() {   
        return hasPrePage;   
    }   
       
    /**  
     * @param hasPrePage   
     * The hasPrePage to set.  
     */  
    public void setHasPrePage(boolean hasPrePage) {   
        this.hasPrePage = hasPrePage;   
    }   
       
    /**  
     * @return Returns the totalPage.  
     *   
     */  
    public int getTotalPage() {   
        return totalPage;   
    }   
       
    /**  
     * @param totalPage   
     * The totalPage to set.  
     */  
    public void setTotalPage(int totalPage) {   
        this.totalPage = totalPage;   
    }

	public List getResult() {
		return result;
	}

	public void setResult(List result) {
		this.result = result;
	}

	public int getNextpage() {
		return nextpage;
	}

	public int getPrepage() {
		return prepage;
	}

	public void setNextpage(int nextpage) {
		this.nextpage = nextpage;
	}

	public void setPrepage(int prepage) {
		this.prepage = prepage;
	}   
       
}
